import request from '@/utils/request'

// 创建积分记录
export function createIntegralRecord(data) {
  return request({
    url: '/exam/integral-record/create',
    method: 'post',
    data: data
  }) 
}

// 更新积分记录
export function updateIntegralRecord(data) {
  return request({
    url: '/exam/integral-record/update',
    method: 'put',
    data: data
  })
}

// 删除积分记录
export function deleteIntegralRecord(id) {
  return request({
    url: '/exam/integral-record/delete?id=' + id,
    method: 'delete'
  })
}

// 获得积分记录
export function getIntegralRecord(id) {
  return request({
    url: '/exam/integral-record/get?id=' + id,
    method: 'get'
  })
}

// 获得积分记录分页
export function getIntegralRecordPage(query) {
  return request({
    url: '/exam/integral-record/page',
    method: 'get',
    params: query
  })
}

// 导出积分记录 Excel
export function exportIntegralRecordExcel(query) {
  return request({
    url: '/exam/integral-record/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

//获取所有用户总分并排名
export function getRankAll(query) {
  return request({
    url: '/exam/integral-record/rank-all',
    method: 'get',
    params: query
  })
}

//获取考试排名最高分与参与次数
export function getExamRecordRankAll(query) {
  return request({
    url: '/exam/examination-record/getExamRecordRankAll',
    method: 'get',
    params: query
  })
}